package com.eliza.nava.fg.a

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.Navigation
import com.eliza.nava.R
import kotlin.math.log

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

/**
 * A simple [Fragment] subclass.
 * Use the [Fg3.newInstance] factory method to
 * create an instance of this fragment.
 */
class AFg2 : Fragment() {
    // TODO: Rename and change types of parameters
    private var param1: String? = null
    private var param2: String? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            param1 = it.getString(ARG_PARAM1)
            param2 = it.getString(ARG_PARAM2)
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        val view = inflater.inflate(R.layout.fragment_a_fg2, container, false)

        /**
         * 接收数据
         * */
        val AFg1 = arguments?.getString("AFg1")
        AFg1?.let { Log.e(this::class.java.name, it) }
        view.findViewById<View>(R.id.fg_a_2to3_btn).setOnClickListener {
            Navigation.findNavController(view).navigate(R.id.action_AFg2_to_AFg3)
        }
        return view
    }

}